package com.mars.admin.modules.post.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mars.admin.modules.base.entity.BaseEntity;
import com.mars.admin.framework.listener.EntityChangeListener;
import com.mybatisflex.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

/**
 * 帖子评论实体类
 *
 * @author Mars
 * @version 1.0
 * @date 2025-01-07
 */
@Data
@Accessors(chain = true)
@Table(value = "tb_post_comment", onInsert = EntityChangeListener.class, onUpdate = EntityChangeListener.class)
@Schema(description = "帖子评论")
public class PostComment {

    private static final long serialVersionUID = 1L;

    /**
     * 评论ID
     */
    @Id(keyType = KeyType.Auto)
    @Schema(description = "评论ID", example = "1")
    private Long id;

    /**
     * 帖子ID
     */
    @Schema(description = "帖子ID", example = "1", requiredMode = Schema.RequiredMode.REQUIRED)
    @Column("post_id")
    private Long postId;

    /**
     * 评论用户ID
     */
    @Schema(description = "评论用户ID", example = "1", requiredMode = Schema.RequiredMode.REQUIRED)
    @Column("user_id")
    private Long userId;

    /**
     * 父评论ID
     */
    @Schema(description = "父评论ID", example = "1")
    @Column("parent_id")
    private Long parentId;

    /**
     * 回复用户ID
     */
    @Schema(description = "回复用户ID", example = "2")
    @Column("reply_user_id")
    private Long replyUserId;

    /**
     * 评论内容
     */
    @Schema(description = "评论内容", example = "很棒的分享！", requiredMode = Schema.RequiredMode.REQUIRED)
    @Column("content")
    private String content;

    /**
     * 评论图片
     */
    @Schema(description = "评论图片", example = "[\"https://example.com/1.jpg\"]")
    @Column("images")
    private String images;

    /**
     * 点赞数
     */
    @Schema(description = "点赞数", example = "5")
    @Column("like_count")
    private Integer likeCount;

    /**
     * 回复数
     */
    @Schema(description = "回复数", example = "2")
    @Column("reply_count")
    private Integer replyCount;

    /**
     * 是否置顶
     */
    @Schema(description = "是否置顶：0-否，1-是", example = "0")
    @Column("is_top")
    private Integer isTop;

    /**
     * 状态
     */
    @Schema(description = "状态：1-正常，2-已删除，3-审核中，4-审核拒绝", example = "1")
    @Column("status")
    private Integer status;
    /**
     * 创建时间
     */
    @Schema(description = "创建时间", example = "2024-01-01 12:00:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(onInsertValue = "now()")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @Schema(description = "更新时间", example = "2024-01-01 12:00:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(onInsertValue = "now()", onUpdateValue = "now()")
    private LocalDateTime updateTime;

    /**
     * 是否删除：0-否，1-是
     */
    @Schema(description = "是否删除", example = "0", hidden = true)
    @Column(value = "is_deleted", isLogicDelete = true)
    private Integer isDeleted;

    /**
     * 删除时间
     */
    @Schema(description = "删除时间", example = "2024-01-01 12:00:00", hidden = true)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column("delete_time")
    private LocalDateTime deleteTime;

} 